import * as React from "react";
import DtPowerCondition, { DtPowerDevice } from "./compontents/Condition";
import DTTable from "./compontents/DTTable";
import "./index.less";
export interface EquipmentMonitoringProps {}

export interface EquipmentMonitoringState {}

class EquipmentMonitoring extends React.Component<
  EquipmentMonitoringProps,
  EquipmentMonitoringState
> {
  private dtDevice: DtPowerDevice = {
    deviceId: null,
    no: null,
    name: null,
    devAddr: null,
  };
  //设备最新瞬时量数据
  private lastData: any = null;
  chooseDevice(device: DtPowerDevice) {
    this.dtDevice = device;
    this.forceUpdate();
  }
  render() {
    return (
      <div className="EquipmentMonitoring">
        <div className="bare_body" style={{ marginBottom: 12 }}>
          <DtPowerCondition
            chooseDevice={(device: DtPowerDevice) => {
              this.chooseDevice(device);
            }}
            query={(param) => {
              console.log(param);
            }}
          />
          <DTTable device={this.dtDevice} lastData={this.lastData} />
        </div>
      </div>
    );
  }
}

export default EquipmentMonitoring;
